package com.harmony.pilot.knowledge.repository;

import com.harmony.pilot.knowledge.entity.IncludeDependency;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * Include依赖关系Repository
 */
@Repository
public interface IncludeDependencyRepository extends JpaRepository<IncludeDependency, Long> {
    
    /**
     * 根据文件路径查找所有依赖
     */
    List<IncludeDependency> findByFilePath(String filePath);
    
    /**
     * 根据解析后的实际路径查找依赖该头文件的所有文件
     */
    List<IncludeDependency> findByResolvedPath(String resolvedPath);
    
    /**
     * 根据文件路径和include路径查找（去重用）
     */
    Optional<IncludeDependency> findByFilePathAndIncludePath(String filePath, String includePath);
    
    /**
     * 根据include类型查找
     */
    List<IncludeDependency> findByIncludeType(String includeType);
    
    /**
     * 查找已解析的依赖
     */
    List<IncludeDependency> findByResolved(Boolean resolved);
}

